// AC
#include <stdio.h>

struct node
{
    int sheng;
    int ke;
};

struct node sn[5];

int main()
{
    int i, n;
    sn[0].sheng = 3;
    sn[0].ke = 2;
    sn[1].sheng = 4;
    sn[1].ke = 5;
    sn[2].sheng = 2;
    sn[2].ke = 4;
    sn[3].sheng = 5;
    sn[3].ke = 1;
    sn[4].sheng = 1;
    sn[4].ke = 3;

    scanf("%d", &n);

    for(i=0; i<n; i++){
    	int a, b;
    	scanf("%d %d", &a, &b);
        
        if(sn[a-1].sheng == b) printf("%d sheng %d\n", a, b);
        else if(sn[a-1].ke == b) printf("%d ke %d\n", a, b);
        else if(sn[b-1].sheng == a) printf("%d sheng %d\n", b, a);
        else if(sn[b-1].ke == a) printf("%d ke %d\n", b, a);
    }

    return 0;
}
